package v1

import (
	"gin-wheel/pkg"
	"gin-wheel/pkg/app"
	"gin-wheel/pkg/errcode"
	"strconv"

	"github.com/gin-gonic/gin"
)

type snowflakeRouter struct{}

func NewSnowflakeRouter() *snowflakeRouter {
	return &snowflakeRouter{}
}

var snowflakeObj = pkg.CreateSnowflake()

func (*snowflakeRouter) GenerateIds(c *gin.Context) {

	response := app.NewResponse(c)
	var snowflakeIds [100]string
	var _id int64
	for i := 0; i < 100; i++ {
		_id = snowflakeObj.GetId()
		snowflakeIds[i] = strconv.Itoa(int(_id))
	}
	response.ToResponse(errcode.Success, snowflakeIds)
	return
}
